﻿namespace CodingExercises._31_40;

public class FibonacciSequence
{
    // 生成斐波那契数列 
    public static IEnumerable<int> Method(int cap)
    {
        int previous = 0;
        int current = 1;

        while (previous <= cap)
        {
            yield return previous;

            int tmp = previous + current;
            previous = current;
            current = tmp;
        }
        
    }
}